package com.scorpio.agentuser.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.scorpio.common.core.domain.BaseEntity;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.scorpio.common.annotation.Excel;

/**
 * 代理商用户对象 agent_user
 *
 * @author scorpio
 * @date 2020-09-25
 */
@Data
@TableName("agent_user")
public class AgentUserEntity extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @TableId
    private Long id;

    @Excel(name = "上级代理商ID")
    private Long pid;

    @Excel(name = "是否有效 0=有效,1=无效")
    private String status;

    @Excel(name = "等级划分 1=合伙人,2=省级代理,3=市级代理,4=业务员")
    private Integer agentLevel;

    @Excel(name = "所在省份ID")
    private Long provinceId;

    @Excel(name = "所在城市ID")
    private Long cityId;

    @Excel(name = "所在区域")
    private Long districtId;

    @Excel(name = "详细地址")
    private String address;

    @Excel(name = "代理商公司或姓名")
    private String agentName;

    @Excel(name = "电话手机")
    private String phone;

    @Excel(name = "帐号")
    private String username;

    @Excel(name = "密码")
    private String password;

    @Excel(name = "邀请码")
    private String inviteCode;

    @Excel(name = "直推比例 100=100%")
    private Float directScale;

    @Excel(name = "间推比例 100=100%")
    private Float indirectScale;

    @Excel(name = "链式关联")
    private String chain;

    @JsonIgnore
    @JsonProperty
    public String getPassword() {
        return password;
    }

    @TableField(exist = false)
    private String provinceName;

    @TableField(exist = false)
    private String cityName;

    @TableField(exist = false)
    private String districtName;


    //直推人数
    @TableField(exist = false)
    private int directTotali;

    //间推人数
    @TableField(exist = false)
    private int indirectTotali;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("remark", getRemark())
                .append("status", getStatus())
                .append("agentLevel", getAgentLevel())
                .append("cityId", getCityId())
                .append("agentName", getAgentName())
                .append("phone", getPhone())
                .append("createTime", getCreateTime())
                .append("districtId", getDistrictId())
                .append("createBy", getCreateBy())
                .append("username", getUsername())
                .append("password", getPassword())
                .append("provinceId", getProvinceId())
                .append("updateBy", getUpdateBy())
                .append("inviteCode", getInviteCode())
                .append("directScale", getDirectScale())
                .append("id", getId())
                .append("chain", getChain())
                .append("indirectScale", getIndirectScale())
                .append("pid", getPid())
                .append("address", getAddress())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
